package view.component.dialog
{
	import framework.core.ComponentBuilder;
	
	import view.component.window.WindowComponent;
	
	public class ConfirmDialog extends WindowComponent
	{
		public function ConfirmDialog()
		{
			super();
		}
		
		public static function show(data:* , yesCallBack:Function = null , noCallBack:Function = null , titleText:String = "" , yesBtnTxt:String = "" , noBtnTxt:String = "" , confirmClass:Class = null ):ConfirmDialog
		{
			var confirmDialog:ConfirmDialog = ComponentBuilder.create(confirmClass ? confirmClass : ConfirmDialog) as ConfirmDialog;
			if(titleText != "")confirmDialog.confirmProxy.titleTxt = titleText;
			confirmDialog.confirmProxy.data = data;
			if(yesBtnTxt != "") confirmDialog.confirmProxy.yesBtnTxt = yesBtnTxt;
			if(noBtnTxt != "") confirmDialog.confirmProxy.noBtnTxt = noBtnTxt;
			confirmDialog.confirmProxy.onYesCallBack = yesCallBack;
			confirmDialog.confirmProxy.onNoCallBack = noCallBack;
			
			confirmDialog.show();
			
			return confirmDialog;
		}
		
		public static function showAlert(cotantText:String , yescallBack:Function = null , titleText:String = "" , yesBtnTxt:String = "" , alertClass:Class = null):ConfirmDialog
		{
			return show(cotantText , yescallBack , null , titleText , yesBtnTxt , "" , alertClass ? alertClass : AlertDialog);
		}
		
		public function get confirmProxy():ConfirmDialogProxy
		{
			return proxys["window"];
		}
		
		override protected function get skinReference():String
		{
			return "swf.ui.ConfirmDialogSkin";
		}
		
		override protected function get proxyMapping():Array
		{
			return [{ skin:"", classRef: ConfirmDialogProxy, id:"window" }];
		}
		
	}
}
